home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
clockl.zip
/
VBCLOCK.FRM
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1992-12-16
|
10KB
|
207 lines
VBClockForm
Title Bar Clock
Arial
Form1
Timer1
Label2
Label2
Arial
Label1
Label 1
Arial
Form1t
Form_Load
Timer1_TimerT
GetFocus
GetActiveWindow
GetWindowText
lpString
OldWinText
OldText=
NewText
SetWindowText
Handle.
OldHandle
WindowState
IsIconic
FixTitle
WinHand
NoTime
UseTime@
DisplayTime
NexText
Form_Paint
Form_MouseUp
Button
Shift]
Form_Resize
Visible
GetParent
IsWindowVisible
OldString
OldStri
OldHand
COLOR_BACKGROUNDg
BackGroundColor=
BackColor
IsWindow
ParentHandle<
TempVarc
Parenth
ShowTime}
Captiono
Label1_Click3
Label1+
Width#
Height{
FalseThen3
GetWindowTextLength
SendMessage
wParam
lParam
WM_SETTEXT
NewMess2
IsWindowEnabled
AndIfO
ThenSetWindowText
FakeSpaceL
SpacerA
SpacerAs
OldParent
WindHand
GetClassName
lpClassName
nMaxCount
Class
FindWindow
CName
wHandle
wwHandle
OldwHandle
Label2
Lable2
GetLastActivePopup
hwndOwnder<
GetWindowWord
nIndex
GWW_HINSTANCE]
GetModuleFileName
hModule
lpFilename
nSizer
VBEnv
Label3
Label2_Click
OldProgenitord
OldWinHand
Progenitor
WinGetActive
OldActive
OldTarget
Kernel
FixTitle
not spacebar, but alt-160r
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
FixTitle takes two parameters--the title of the
window, and a true/false flag indicating
whether it should display the current
time in the window's titlet
begin by calling DoEvents() to let other apps do their*
thing--displaying the time is a low priority item.h
then try to get the handle of the active window's parent window.*
if it has one thene
if the parent is visible and it has a caption, set WinHand% to the
parent's handle
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
X = DoEvents()
Get the Patriarch if any
Kludge for VB Dev environmentt
Substite top editor window for
hidden partriarcho
tried looking for classname/but same for compiled and runtimet
wndclass_desked_gsk
VB.EXE
If there is a parent and it has a caption and its window is visible then make it the target window
If Progenitor% = OldProgenitor% And GetActiveWindow() = OldActive% Then
Debug.Print OldWinHand%, OldActive%
Exit Sub
Else
OldActive% = GetActiveWindow()o
End If
If OldWinHand% = GetActiveWindow() Then Exit Sub
OldWinHand% = wHandle%
nd Iff
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
next, get the caption of the active window (or its parent)*
if it doesn't have one, exit the subw
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
otherwise, strip off the null character (CHR$(0) from the end of the
fixed length string that contains the caption
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
now set the new caption equal to the old caption*
and look to see if the new caption contains a FakeSpace$
(the FakeSpace$ is used to proceding the time display)e
and if so, strip off the time
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
next strip off any extra spaces from the new caption string
and, if ShowTime% is True, add the time and date to the new caption stringp
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Short Date
hh:mm am/pm
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
finally, if the window handle is still valid, and the window is visible,
and the new caption isn't the same as the old caption
set the window's title to the new caption
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Form_Load
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* as VB Clock loads
* first set the caption on Label1 to display the current time,*
* then minimize the VB Clock window
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Short Date
hh:mm:ss am/pm
Copyright
1992 Paul Bonner
Form_Resize
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* whenever the form is resized,
* center the label that displays
* the current time
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Timer1_Timer
Static wHandle%%
Static OldTarget%e
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
begin by getting the*
the handle of the active window.*
if it has changed since the last timer event*
call Fixtitle, telling it to remove the time from the old active window.*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
OldWinHand=old active window
OldTarget%=previous target
'OldTarget% Then
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
next, check to see whether VB Clock is minimized*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
minimizedm
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
if VB Clock is minimized
check to see if the active window is iconic
if so, exit
otherwise, call FixTitle again, telling it to display the
time in the active window's title bar
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
not minimized
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
if VB Clock is not minimized,*
update the caption for Label1 on the VB Clock form
to display the current time
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
OldTarget% ThenT
Short Date
hh:mm:ss am/pm